package com.heu.picture.holder;

import com.heu.picture.entity.UserPO;

public class UserHolder {

    private static final ThreadLocal<UserPO> userThreadLocal = new ThreadLocal<>();

    public static Long getCurrentUserId() {
        UserPO userPO = userThreadLocal.get();
        if (userPO == null) {
            return null;
        }
        return userPO.getId();
    }

    public static void saveUser(UserPO userPO) {
        userThreadLocal.set(userPO);
    }
}
